﻿<?php 

require_once __DIR__ . '..\apiCur.php';

$wx=new wxGet();

$token=$wx->getToken('wx865deb1a17f23804','e51f4c1ec21e87c01ab7fdbb2d2ffaab'); //测试的
$jsapi_ticket=$wx->getDate('cgi-bin/ticket/getticket',['access_token'=>$token,'type'=>'jsapi'])['ticket'];
$timestamp=time();
$nonceStr=randomkeys(10);

$sing="jsapi_ticket={$jsapi_ticket}&noncestr={$nonceStr}&amp;timestamp={$timestamp}&url=http://mp.weixin.qq.com?params=value";

//var_dump(sha1($sing));

echo sha1($sing);

function randomkeys($length) 
{ 
 $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWYZ';
 for($i=0;$i<$length;$i++) 
 { 
  $key .= $pattern{mt_rand(0,35)}; //生成php随机数 
 } 
 return $key; 

} 



 ?>